<include file="Public/header" />
<style type="text/css">
    .content-block{
        margin: 0;
        padding: 0;
    }
    .record-list table thead tr td{color: #666666;}
</style>
</head>

<body>
<div class="page-group">
    <div class="page page-current">
        <header class="bar bar-nav search">
            <a class="button button-link button-nav pull-left back" href="javascript:window.history.go(-1)">
                <span class="icon icon-left"></span>
            </a>
            <h1 class="title">预约记录</h1>
            <a class="button button-link button-nav pull-right" href="/">
                <span class="icon icon-home"></span>
            </a>
        </header>
        <div class="content">
            <div class="buttons-tab">
              <a href="#tab1" class="tab-link active button">预约记录</a>
              <a href="#tab2" class="tab-link button">报名记录</a>
            </div>
            <div class="content-block">
              <div class="tabs">
                <div id="tab1" class="tab active">
                  <div class="content-block">
                     <div class="ds-title new-title" style="margin-top: 0;">
                        <span class="sel" type="2" >科目三</span>
                        <span class="b-gray sel" type="1" >科目二</span>
                        预约记录
                    </div>
                    <div class="record-list" style="padding:0">
                        <table border="0" cellspacing="0" cellpadding="10" style="text-align: center;">
                            <thead>
                            <tr>
                                <td width=15%;>教练</td>
                                <td width=25%;>时间</td>
                                <td width=10%;>学时</td>
                                <td width=10%;>类别</td>
                                <td width=15%;>价格</td>
                                <td width=15%;>状态</td>
                            </tr>
                            </thead>

                            <tbody id="info">

                            </tbody>
                        </table>
                    </div>
                  </div>
                </div>
                <div id="tab2" class="tab">
                  <div class="content-block">
                      <div class="record-list" style="padding:0">
                     <table border="0" cellspacing="0" cellpadding="10" style="text-align: center;">
                            <thead>
                            <tr>
                                <td width=25%;>驾校名称</td>
                                <td width=15%;>报名人</td>
                                <td width=10%;>价格</td>
                                <td width=15%;>时间</td>
                                <td width=15%;>状态</td>
                                <td width=15%;>操作</td>
                            </tr>
                            </thead>

                            <tbody id="info2">

                            </tbody>
                        </table>
                      </div>
                  </div>
                </div>
              </div>
            </div>
         </div>
    </div>
</div>
</body>
<script>
    $(".sel").click(function(){
        $(".sel").removeClass('b-gray');
        $(this).addClass('b-gray');
        var type = $(this).attr('type');
        $("#info").find('tr').remove();
        ajax_index(type);
    });

    $(function(){
        var index = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
        ajax_index('all');
        baoming();
    });

    function ajax_index(type){
        $.ajax({
            url : "{:U('ajax_index')}",
            data:{type:type},
            type:'get',
            success:function(data){
                $("#info").append(data);
            }
        });
    }
    //报名记录
     function baoming(){
        $.ajax({
            url : "{:U('baoming')}",
            type:'post',
            success:function(data){
                layer.closeAll();
                $("#info2").append(data);
            }
        });
    }
    function backMoney(){
          layer.confirm('确定要退款吗？退款成功后1到5个工作日到账，如果没有到账请联系中原银行！', {
            btn: ['确定','取消'] //按钮
          }, function(){
              //退款
              layer.closeAll();
              var index = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
          });
    }
    function backPrice(id){
        layer.confirm('确定要退款吗？退款成功后1到5个工作日到账，如果没有到账请联系中原银行！', {
            btn: ['确定','取消'] //按钮
          }, function(){
               $.ajax({
                 url:"{:U('backPrice')}", 
                 type:'post',
                 data:{id:id},
                 success:function(e){
                    layer.closeAll();
                    if(e == 1){
                        //调起退款
                        var index = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
                        
                    }else{
                        
                        layer.msg('距离开始时间少于6个小时，不能退款');
                    }
                 }
              });
          }, function(){
            
        });
    }
</script>

<include file="Public/footer" />